cmake_minimum_required(VERSION 3.20)
project(ldacs_corenet C)

set(CMAKE_C_STANDARD 11)

set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=address -g")

INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include)
INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include/elements)

add_executable(${PROJECT_NAME} main.c  )

target_link_libraries(${PROJECT_NAME} LINK_PUBLIC cn::src)

find_package(SQLite3 REQUIRED)
if (SQLite3_FOUND)
    include_directories(${SQLite3_INCLUDE_DIRS})
    target_link_libraries(${PROJECT_NAME} LINK_PUBLIC ${SQLite3_LIBRARIES})
    message(${SQLite3_VERSION})
endif (SQLite3_FOUND)

find_package(LiteLdacsSdk REQUIRED)
if (LiteLdacsSdk_FOUND)
    include_directories(${LiteLdacsSdk_INCLUDE_DIRS})
    include_directories(${LiteLdacsSdk_INCLUDE_GLOBAL_DIRS})
    link_libraries(liteldacssdk::liteldacssdk)
endif ()

find_package(Ldacscrypto REQUIRED)
if (Ldacscrypto_FOUND)
    include_directories(${Ldacscrypto_INCLUDE_DIRS})
    link_libraries(ldacscrypto::ldacscrypto)
endif ()

add_subdirectory(src)

set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=leak -g")
